package de.jmda.core.util.fileset;

import java.io.File;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 * Accepts existing .java files only.
 */
// 
@XmlRootElement(namespace = FileSet.XML_NAMESPACE)
@XmlAccessorType(XmlAccessType.FIELD)
public class FileFilterJavaSourceFilesOnly extends FileFilterBase
{
	public boolean accept(File file)
	{
		if (file.isDirectory())
		{
			return false;
		}
		if (file.exists() &&
		    file.isFile() &&
		    file.getAbsolutePath().endsWith(".java"))
		{
			return true;
		}
		return false;
	}

	@Override
  public String getDescription()
  {
		return ".java files only";
  }
}